import { Library } from "@/api/service/library/types";
import { currentShape } from "@/views/paint/modules/data/shapes";

export const fileSelectorConfig = ref({
  type: "1",
  show: false
});

export const setMediaSrc = (library: Library[]) => {
  const url = library[0].uri;
  if (currentShape.value.type.includes("image")) {
    currentShape.value.cacheSrc = url;
  }
  currentShape.value.src = url;
};

export const setImage = () => {
  fileSelectorConfig.value.type = "0";
  fileSelectorConfig.value.show = true;
};

export const setVideo = () => {
  fileSelectorConfig.value.type = "1";
  fileSelectorConfig.value.show = true;
};
